package com.infomanage.enums;

import java.util.HashMap;
import java.util.Map;

public enum AttendanceResultType {
	WDJ(0,"未登记"),
	CQ(12,"出勤"),
	HCT(1, "婚产探"),
	SHJ(2, "伤"),
	SAJ(3, "丧"),
	JY(4, "节育"),
	HJ(13, "孩假"),
	BJ(5, "病假"),
	SJ(6, "事假"),
	KG(7, "旷工"),
	YB(8, "夜班"),
	LX(9, "轮休"),
	JX(10, "节休"),
	GJ(11, "公假");
	
	private int value;
	private String title;

	AttendanceResultType(int value, String title) {
		this.value = value;
		this.title = title;
	}

    /**
     * 获取枚举值
     * @return 返回枚举值
     */
	public int value() {
		return this.value;
	}

    /**
     * 获取枚举标题
     * @return 返回枚举的标题
     */
	public String title() {
		return this.title;
	}

	private static Map<String, AttendanceResultType> titlefinder;
	static {
		titlefinder = new HashMap<String, AttendanceResultType>();
		for (AttendanceResultType item : AttendanceResultType.values())
			titlefinder.put(item.title(), item);

	}

	private static Map<Integer, AttendanceResultType> valuefinder;
	static {
		valuefinder = new HashMap<Integer, AttendanceResultType>();
		for (AttendanceResultType item : AttendanceResultType.values())
			valuefinder.put(new Integer(item.value()), item);

	}

	/**
	 * 按照枚举值查找枚举
	 * 
	 * @param value
	 *            数据类型值对象
	 * @return 返回枚举值对象
	 */
	public static AttendanceResultType valueOf(int type) {
		return valuefinder.get(new Integer(type));
	}
	
	/**
	 * 按照枚举标题查找枚举值
	 * 
	 * @param value
	 *            数据类型值对象
	 * @return 返回枚举值对象
	 */
	public static AttendanceResultType titleOf(String title) {
		return titlefinder.get(title);
	}
	
	public static AttendanceResultType[] getMembers() {
		return new AttendanceResultType[] {WDJ, CQ, HCT, SHJ, SAJ, JY, HJ, BJ, SJ, KG, YB, LX, JX, GJ};
	}
}
